<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
<head>
    <title>Title</title>
    <style type="text/css">
        .message {
            color: red;
        }
    </style>
    <script type="text/javascript" src="jQuery/jquery-1.8.3.js"></script>
    <script type="text/javascript">
        $(function () {
            $("input").blur(function () {
                if ($(this).val() == "") {
                    $(this).parent().after("<td class='message'>内容不能为空</td>")
                }
            });
            $("#add_price,#add_currcount").blur(function () {
                var content = $(this).val();
                if (content !=""){
                    if (isNaN(content) || content < 0) {
                        if ($(this).parent().next().html()==""){
                            $(this).parent().after("<td class='message'>输入内容不合法</td>");
                        }

                    }
                }



            });
        });
    </script>
</head>
<body>
<s:form action="add" enctype="multipart/form-data">
    <s:textfield name="isbn" label="ISBN"/>
    <s:textfield name="name" label="图书名字"/>
    <s:textfield name="author" label="图书作者"/>
    <s:textfield name="publish" label="出版社"/>
    <s:textfield name="price" label="售价"/>
    <s:textfield name="currcount" label="入库数量"/>
    <s:file name="upload" label="图书照片"/>
    <s:submit value="添加"/>
</s:form>
</body>
</html>
